<?php


namespace app\community\oauth2\Entities;


use DateTimeImmutable;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Entities\ScopeEntityInterface;

class AccessTokenEntity implements AccessTokenEntityInterface
{

    protected CryptKey $privateKey;
    protected mixed $identifier;
    protected mixed $userIdentifier;
    protected DateTimeImmutable $ExpiryDateTime;
    protected ClientEntityInterface $client;
    protected array $scope = [];

    public function setPrivateKey(CryptKey $privateKey)
    {
        // TODO: Implement setPrivateKey() method.
        $this->privateKey = $privateKey;
    }

    public function getIdentifier()
    {
        // TODO: Implement getIdentifier() method.
        return $this->identifier;
    }

    public function setIdentifier($identifier)
    {
        // TODO: Implement setIdentifier() method.
        $this->identifier = $identifier;
    }

    public function getExpiryDateTime()
    {
        // TODO: Implement getExpiryDateTime() method.
        return $this->ExpiryDateTime;
    }

    public function setExpiryDateTime(DateTimeImmutable $dateTime)
    {
        // TODO: Implement setExpiryDateTime() method.
        $this->ExpiryDateTime = $dateTime;
    }

    public function setUserIdentifier($identifier): static
    {
        // TODO: Implement setUserIdentifier() method.
        $this->userIdentifier = $identifier;
        return $this;
    }

    public function getUserIdentifier()
    {
        // TODO: Implement getUserIdentifier() method.
        return $this->userIdentifier;
    }

    public function getClient()
    {
        // TODO: Implement getClient() method.
        return $this->client;
    }

    public function setClient(ClientEntityInterface $client): static
    {
        // TODO: Implement setClient() method.
        $this->client = $client;
        return $this;
    }

    public function addScope(ScopeEntityInterface $scope)
    {
        // TODO: Implement addScope() method.
        $this->scope[] = $scope;
    }

    /**
     * @return ScopeEntityInterface[]
     */
    public function getScopes(): array
    {
        // TODO: Implement getScopes() method.
        return $this->scope;
    }

    public function __toString()
    {
        // TODO: Implement __toString() method.
        return $this->identifier;
    }
}